package com.easyapi.common.contants;

import java.util.Arrays;
import java.util.List;

/**
 * 通用常量信息
 *
 * @author javadadi
 */
public class Constants {
    /**
     * interface 配置缓存前缀
     */
    public static final String INTERFACE_CONFIG_PRE = "interface_config::";
    /**
     * interface 配置执行程序分布式锁
     */
    public static final String INTERFACE_CONFIG_EXECUTE_LOCK = "interface:lock:doConfig:lock";
    /**
     * interface path
     */
    public static final String INTERFACE_PATH_MAP = "interface_path_map";
    /**
     * 验证码过期时间-5min
     */
    public static final Long CAPTCHA_EXPIRE_TIME = 5 * 60L;
    /**
     * 使用标志过期时间--周
     */
    public static final Long USING_EXPIRE_TIME = 7 * 24 * 60 * 60L;
    /**
     * UTF-8 字符集
     */
    public static final String UTF8 = "UTF-8";

    /**
     * GBK 字符集
     */
    public static final String GBK = "GBK";


    /**
     * 登录成功
     */
    public static final String LOGIN_SUCCESS = "Success";

    /**
     * 注销
     */
    public static final String LOGOUT = "Logout";

    /**
     * 注册
     */
    public static final String REGISTER = "Register";
    /**
     * 登录失败
     */
    public static final String LOGIN_FAIL = "Error";

    /**
     * 所有权限标识
     */
    public static final String ALL_PERMISSION = "*:*:*";

    /**
     * 管理员角色权限标识
     */
    public static final String SUPER_ADMIN = "admin";

    /**
     * 角色权限分隔符
     */
    public static final String ROLE_DELIMETER = ",";

    /**
     * 权限标识分隔符
     */
    public static final String PERMISSION_DELIMETER = ",";

    /**
     * 验证码有效期（分钟）
     */
    public static final Integer CAPTCHA_EXPIRATION = 2;

    /**
     * 令牌
     */
    public static final String TOKEN = "token";

    /**
     * 令牌前缀
     */
    public static final String TOKEN_PREFIX = "Bearer ";

    /**
     * 令牌前缀
     */
    public static final String LOGIN_USER_KEY = "login_user_key";

    /**
     * 用户ID
     */
    public static final String JWT_USERID = "userid";

    /**
     * 用户头像
     */
    public static final String JWT_AVATAR = "avatar";

    /**
     * 创建时间
     */
    public static final String JWT_CREATED = "createAt";

    /**
     * 密码盐
     */
    public static final String PASSWORD_SLOT = "easy-api-backend-javadadi-";

    /**
     * 错误密码次数key
     */
    public static final String PASSWORD_ERROR = "user-password-error-count::";

    /**
     * 错误密码次数间隔-- min
     */
    public static final Long PASSWORD_ERROR_EXPIRE_TIME = 5 * 60L;

    /**
     * jwt 过期时间
     */
    public static final Long JWT_EXPIRE_TIME = 3  * 60 * 60 * 1000L;

    /**
     * jwt secret
     */
    public static final String JWT_SECRET_KEY = "easy-api-server-backend-javadadi";

    /**
     * redis-user-Key
     */
    public static final String REDIS_USER_KEY = "easy-api-user::";
    /**
     * base-url
     */
    public static final String BASE_URL = "v1/easyapi/server/";
    /**
     * 用户正在使用标志--没有token 过期不在续期
     */
    public static final String SYSTEM_USING = "easy-api-system-using::";

    /**
     * 拦截放开地址
     */
    public static final List<String> EXCLUDE_PATH = Arrays.asList(
            "/v1/easyapi/server/user/register",
            "/v1/easyapi/server/user/login",
            "/v1/easyapi/server/user/getCode",
            "/v1/easyapi/server/user/reGetCode");
}
